# Makefile loco by Gonza
all: cmp_2bits cmp_reg1bit cmp_dff

tests: tb_dff tb_reg1bit tb_2bits

# Componentes compuestos
cmp_2bits: cmp_reg1bit
	ghdl -a cmp_2bits.vhdl
	ghdl -e cmp_2bits

cmp_reg1bit: cmp_and cmp_ts cmp_not cmp_dff
	ghdl -a cmp_reg1bit.vhdl
	ghdl -e cmp_reg1bit

cmp_dff: cmp_dlatch cmp_not
	ghdl -a cmp_dff.vhdl
	ghdl -e cmp_dff

cmp_dlatch: cmp_not cmp_and cmp_or cmp_buf cmp_nand
	ghdl -a cmp_dlatch.vhdl
	ghdl -e cmp_dlatch

# Tablas de prueba
tb_dff: cmp_dff
	ghdl -a tb_dff.vhdl
	ghdl -e tb_dff
	ghdl -r tb_dff --stop-time=50ns --vcd=tb_dff.vcd

tb_reg1bit: cmp_reg1bit
	ghdl -a tb_reg1bit.vhdl
	ghdl -e tb_reg1bit
	ghdl -r tb_reg1bit --stop-time=50ns --vcd=tb_reg1bit.vcd

tb_2bits: cmp_2bits
	ghdl -a tb_2bits.vhdl
	ghdl -e tb_2bits
	ghdl -r tb_2bits --stop-time=50ns --vcd=tb_2bits.vcd

# Componentes elementales
cmp_and:
	ghdl -a cmp_and.vhdl
	ghdl -e cmp_and

cmp_or:
	ghdl -a cmp_or.vhdl
	ghdl -e cmp_or

cmp_buf:
	ghdl -a cmp_buf.vhdl
	ghdl -e cmp_buf

cmp_ts:
	ghdl -a cmp_ts.vhdl
	ghdl -e cmp_ts

cmp_not:
	ghdl -a cmp_not.vhdl
	ghdl -e cmp_not

cmp_nand:
	ghdl -a cmp_nand.vhdl
	ghdl -e cmp_nand

# Limpieza
clean:
	rm -f *.o
	rm -f *.vcd
	rm -f cmp_not cmp_ts cmp_buf cmp_or cmp_and cmp_nand tb_2bits tb_reg1bit tb_dff 
	rm -f cmp_dlatch cmp_dff cmp_reg1bit cmp_2bits
	rm -f work-obj93.cf
